
package com.shop.cloud.mall.api.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.cloud.common.core.util.R;
import com.shop.cloud.mall.common.entity.GoodsBrand;
import com.shop.cloud.mall.api.service.GoodsBrandService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

/**
 * 商品品牌
 *
 * @author
 * @date 2024-09-02 10:45:39
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/goodsbrand")
@Tag(description = "goodsbrand", name = "商品品牌管理")
public class GoodsBrandController {

    private final GoodsBrandService goodsBrandService;

    /**
     * 商品品牌list
     * @param goodsBrand 商品品牌
     * @return
     */
    @Operation(summary = "商品品牌list")
    @GetMapping("/list")
    public R getList(GoodsBrand goodsBrand) {
        return R.ok(goodsBrandService.list(Wrappers.query(goodsBrand)));
    }


    /**
     * 商品品牌分页列表
     * @param page 分页对象
     * @param goodsBrand 商品品牌
     * @return
     */
    @Operation(summary = "商品品牌分页列表")
    @GetMapping("/page")
    public R getPage(Page page, GoodsBrand goodsBrand) {
        return R.ok(goodsBrandService.page(page, Wrappers.query(goodsBrand)));
    }

    /**
     * 商品品牌查询
     * @param id
     * @return R
     */
    @Operation(summary = "商品品牌查询")
    @GetMapping("/{id}")
    public R getById(@PathVariable("id") String id) {
        return R.ok(goodsBrandService.getById(id));
    }

}
